package code;


import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main_0406 {
    public static void main(String[] args) {
        int[] a=new int[]{1,3,4,2,5};
        int[][] aa =new int[][]{{1,2},{2,1},{3,1},{1,3}};
        Stream<int[]> sorted = Arrays.stream(aa);
        List<int[]> list = sorted.collect(Collectors.toList());

        // 优先第一个数字，从小到大
        //其次第二个数，从大到小
        List<int[]> ints = Arrays.stream(aa).sorted((s1,s2)->{
            if(s1[0]!=s2[0] ){
                return s1[0]-s2[0];
            }else if (s1[1] != s2[1]) {
                return s2[1]-s1[1];
            }else {
                return s1[2]-s2[2];
            }
        }).collect(Collectors.toList());
        System.out.println(ints);

        LinkedList<Object> linkedList = new LinkedList<>();
        Arrays.stream(a).boxed().sorted((s1, s2) -> {
            return s2 - s1;
        });
        List<Integer> collect = Arrays.stream(a).boxed().sorted((s1,s2)->{return s2-s1;}).collect(Collectors.toList());
        collect.toArray(new Integer[0]);
        System.out.println(collect);
        int[] ints1 = Arrays.stream(collect.toArray(new Integer[0])).mapToInt(Integer::valueOf).toArray();
    }

}
